//
//  ViewController.m
//  App
//
//  Created by xiongzenghui on 2018/12/28.
//  Copyright © 2018 xiongzenghui. All rights reserved.
//

#import "ViewController.h"

#import <mach-o/dyld.h>
#import <mach-o/loader.h>

static void image_added(const struct mach_header *mh, intptr_t slide)
{
//    _print_image(mh, true);
    printf("[XZH]image_added()\n");
}

static void image_removed(const struct mach_header *mh, intptr_t slide)
{
//    _print_image(mh, false);
    printf("[XZH]image_removed()\n");
}

@implementation ViewController

+ (void)load
{
    printf("[XZH] +[ViewController load]\n");
    
    // 1. 监测动态库被【加载】到可执行文件的进空间
    //_dyld_register_func_for_add_image(&image_added);

    // 1. 监测动态库被【移除】
    //_dyld_register_func_for_remove_image(&image_removed);
}

- (void)viewDidLoad {
    printf("[XZH] +[ViewController viewDidLoad]\n");
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

@end
